<!doctype html>

<html>

<head>

  <meta charset="utf-8">

  <meta content="中文">
  <meta http-equiv="x-dns-prefetch-control" content="on">
  <link rel="dns-prefetch" href="//cdn.bootcss.com">
  <title>{% block title %}My Site{% endblock %}</title>
  {% block styles %}{% endblock %}
  <script src="https://cdn.bootcss.com/lazyload/2.0.3/lazyload-min.js"></script>
<script src="https://cdn.bootcss.com/x-tag/1.5.11/x-tag-core-with-shadowdom.min.js"></script>
<script src="https://cdn.bootcss.com/axios/0.17.0/axios.min.js"></script>
<script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery.pjax/2.0.1/jquery.pjax.min.js"></script>
<script src="https://cdn.bootcss.com/localforage/1.6.0/localforage.min.js"></script>
  {% block script %}{% endblock %}
  <!-- <script>
  (function () {  
    const jsList = [];
    for (let i = 0; i < jsList.length; i++) {
      const ajs = jsList[i];
      if(localStorage.getItem(ajs)){
        $('<scr'+'ipt>'+ localStorage.getItem(ajs) +'</scr'+'ipt>').attr({type:'text/javascript',id:i}).appendTo($('head').remove('#' + i));
      }
      else{            
        $.getScript(ajs,function(data) { 
          localStorage.setItem(ajs, data);
        })
      }      
    }
  })();
  </script> -->

  <!-- <script>
  (function () {  
    const jsList = [];
    let newCache = false;
    for (let i = 0; i < jsList.length; i++) {
      const ajs = jsList[i];
      if(localStorage.getItem(ajs)){
        $('<scr'+'ipt>'+ localStorage.getItem(ajs) +'</scr'+'ipt>').attr({type:'text/javascript',id:i}).appendTo($('head').remove('#' + i));
      }
      else{   
        localStorage.clear();
        newCache = true;

        for (let n = 0; n < jsList.length; n++) {
          const newJs = jsList[n];
          axios.get(newJs).then(function (data) {
            localStorage.setItem(newJs, data.data);
          })          
        }
        break;
      }   
    }   
    if(newCache){
      LazyLoad.js(jsList,function () {});
    }
  })();
  </script> -->
  {% block head-script %}{% endblock %}
</head>

<body {% block bodyevent %}{% endblock %}>
<a href="/index/star">星星点赞</a>
<a href="/index/praise">大拇指点赞</a>
<div id="changeContent">
  {% block content %}{% endblock %}
</div>  
<script>
  $(document).pjax('a','#changeContent');
  localforage.getItem('ad',function(err,value){
    if(value == null){
      $.ajax({
        url: "/index/ad",
        success: function (data) {
          localforage.setItem('ad',data);
          $('body').prepend(data);    
        }
      });
    }
    else{
      $('body').prepend(value);
    }
  })
</script>  
  

</body>

</html>